package org.boot.fast.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.boot.fast.pojo.FileInfoDO;
import org.boot.fast.pojo.CommonResult;
import org.boot.fast.dao.FileInfoDAO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Tag(name = "文件基础信息管理")
@RestController
@RequestMapping("/fast/file/info")
public class FileInfoController {

    @Resource
    private FileInfoDAO fileInfoRepository;

    @GetMapping("/get")
    @Operation(summary = "查询指定文件信息")
    public CommonResult<FileInfoDO> findById(Long id) {
        return CommonResult.success(fileInfoRepository.findOne(id));
    }

    @GetMapping("/list")
    @Operation(summary = "查询当前服务下所有文件信息")
    public CommonResult<List<FileInfoDO>> findList(FileInfoDO fileInfoDO) {
        return CommonResult.success(fileInfoRepository.findList(fileInfoDO));
    }


}
